/**
 * 
 */
package com.boot.springBoot.util;

import java.util.UUID;

/**
 * 生成唯一的id
 * @author Administrator
 *
 */
public class UuidGenerated {
	
	
	/**
	 * 生成UUID
	 */
	private static String getUuidFirst() {
		UUID uuid = UUID.randomUUID();
		String id = uuid.toString().replaceAll("-", "");
		return id;
	}
	
	
	/**
	 *生成UUID 
	 */
	private static String getUuidSecond() {
		UUID uuid = UUID.randomUUID();
		String str = uuid.toString();
		System.out.println("str: "+str);
        return str.substring(0, 8) + str.substring(9, 13) + str.substring(14, 18) + str.substring(19, 23) + str.substring(24);

	}
	
	public static void main(String[] args){
		System.out.println("uuid1=="+UUID.randomUUID());
		System.out.println("uuid2=="+getUuidSecond());
	}
}
